home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Macromedia Multimedia Showcase 5.1
/
Macromedia - Multimedia Showcase 5.1 (Macromedia) (1996).ISO
/
pc
/
media
/
shared.dir
/
02004_Script_Glossary Script
< prev
next >
Wrap
Text File
|
1996-03-28
|
5KB
|
170 lines
-- Glossary Script
on InitGlossary
global GlossaryList
set GlossaryList = [ ]
global gGlossaryListSprite -- sprite that contains the scrolling bitmap with all
set gGlossaryListSprite = 6 -- glossary items in a list
global gGlossHiliteSprite
set gGlossHiliteSprite = 7
global glossaryTextSprite
set glossaryTextSprite = 8
global deltaY -- how many pixels to vertically scroll the text bitmap
set deltaY = 24
global windowHeight
set windowHeight = 11 -- how many glossary items fit in single view of scrolling window
global textTopMargin, textLeftMargin, hiliteTopMargin, hiliteLeftMargin
-- set textTopMargin = integer((the height of cast "glossary list")/2 - 142)
set textTopMargin = -99
set textLeftMargin = 75 + integer(the width of cast "glossary list"/2)
set hiliteTopMargin = 194
set hiliteLeftMargin = integer(the width of cast "glossary hilite"/2)
global glossScroll
set glossScroll = 0
end InitGlossary
--
-- LaunchGlossary() is called from event database, upon entering the glossary screen
on LaunchGlossary
-- put "LaunchGlossary()"
global gNavObj
set firstBtn = the firstBtnSprite of gNavObj
repeat with i = firstBtn to firstBtn+3
set the lineSize of sprite i = 0
end repeat
ScrollToVisible()
DrawFields()
SetGlossaryText()
end LaunchGLossary
--
on AddGlossaryExitScript
global gNavObj
Add (the exitQue of gNavObj), "CloseGlossary"
end AddGlossaryExitScript
--
on CloseGlossary
-- put "CloseGlossary()"
global glossaryTextSprite
puppetSprite glossaryTextSprite, FALSE
-- AUT: now, store glossaryItemName so that you pre-load glossary to this item
end CloseGlossary
--
on ScrollGlossaryUp
global glossScroll
if glossScroll>0 then
set glossScroll = glossScroll - 1
DrawFields()
else
beep
end if
end ScrollGlossaryUp
--
on ScrollGlossaryDown
global glossScroll, lastItem, windowHeight
if glossScroll < lastItem-windowHeight then
set glossScroll = glossScroll + 1
DrawFields()
else
beep
end if
end ScrollGlossaryDown
--
on DrawFields
global glossScroll, textTopMargin, textLeftMargin, hiliteTopMargin, hiliteLeftMargin
global lastItem, gGlossaryListSprite, gGlossHiliteSprite, currentGlossaryItem, deltaY
set the locV of sprite gGlossaryListSprite = textTopMargin + ¼
integer((lastItem-glossScroll)*deltaY)
set the locV of sprite gGlossHiliteSprite = ¼
integer(currentGlossaryItem*deltaY+textTopMargin+hiliteTopMargin) - glossScroll*deltaY
set the locH of sprite gGlossaryListSprite = textLeftMargin
set the locH of sprite gGlossHiliteSprite = hiliteLeftMargin
end DrawFields
--
on ScrollToVisible
global currentGlossaryItem, glossScroll, windowHeight, lastItem
set glossScroll = min(currentGlossaryItem-1,(lastItem-windowHeight))
end ScrollToVisible
--
on ClickGlossary
set clickY = the mouseV
global currentGlossaryItem, gGlossaryListSprite, textTopMargin, deltaY, glossScroll
global GlossaryList, glossaryItemName
set myItem = integer((clickY-textTopMargin-3)/deltaY + glossScroll - 8)
global lastItem
if myItem = lastItem+1 then set myItem = lastItem
if myItem = 0 then set myItem = 1
set currentGlossaryItem = myItem
getAt GlossaryList, currentGlossaryItem
set glossaryItemName = the result
DrawFields()
SetGlossaryText()
end ClickGlossary
--
on SetGlossaryText
global currentGlossaryItem, glossaryTextSprite, glossaryItemName
puppetSprite glossaryTextSprite, TRUE
set myCastName = "glossary:" & glossaryItemName
set the castNum of sprite glossaryTextSprite = cast myCastName
set the loc of sprite glossaryTextSprite = point(270,140)
updateStage
end SetGlossaryText
--
on GoGlossary whichLabel
global GlossaryList, currentGlossaryItem, glossaryItemName
set glossaryItemName = string(value(whichLabel))
getOne GlossaryList, glossaryItemName
set currentGlossaryItem = the result
set GlossaryID = "80000" -- AUT: hardwired SceneID for glossary
global gNavObj
set the direction of gNavObj = #jump
LoadSeq(gNavObj, GlossaryID)
ChangeScene(gNavObj, GlossaryID)
end GoGlossary
--
on AddGlossaryItem whichItem
set whichItem = string(word 2 of whichItem)
set myLast = length(whichItem)
set whichItem = char 2 to myLast of whichItem
global GlossaryList
GetOne glossarylist, whichItem
if the result = 0 then -- unique item that does not exist in glossary
add GlossaryList, whichItem
end if
end AddGlossaryItem
--
on PrepGlossaryList
global GlossaryList, lastItem
sort GlossaryList
-- put GlossaryList
set lastItem = count(GlossaryList)
global currentGlossaryItem
set currentGlossaryItem = 1
global glossaryItemName
getAt GlossaryList, 1
set glossaryItemName = the result
end PrepGlossaryList